//var msg_nameFocus = '6-20个字符，支持字母、数字及“-”、“_”';
var msg_nameFocus = '4-20个字符，支持字母、数字、符号及中文';
var msg_nameNotEmpty = '请输入用户名';
//var msg_nameLength6To20 = '长度应为6-20个字符';
var msg_nameLength4To20 = '用户名长度只能在4-20个字符之间';
//var msg_nameInvalidCode = '用户名只能由字母、数字或者“_”、“-”组成';
var msg_nameInvalidCode = '用户名只能由中文、英文、数字及"-"、"_"组成';
var msg_nameContainSensitiveWords = '该用户名已被占用，请更换用户名';
var msg_nameCanntAllNumber = '不能是纯数字，请重新输入';
var msg_nameSuccess = '注册成功将不能修改';
//var msg_passwordFocus = '6-20个字符，包含字母、数字或符号';
var msg_passwordFocus = '6-20个字符，建议由字母，数字与符号两种以上组成';
var msg_passwordNotEmpty = '请输入密码';
var msg_passwordLength6To20 = '长度应为6-20个字符';
var msg_passwordCanntSameWord = '不能为同一字符';
var msg_passwordCanntAllNumber = '不能全为数字';
var msg_passwordInvalidCode = '非法字符，请使用字母加数字或符号的组合，6-20个字符';
var mag_passwordSameUserName = '用户名和密码不能相同，请重新输入！';
var msg_confirmPasswordFocus = '请再次输入密码';
var msg_confirmPasswordNotSame = '两次密码不一致';
var msg_authenticCodeFocus = '请输入验证码';
var msg_authenticCodeNotEmpty = '请输入验证码';
var msg_authenticCodeOutOfDate = '验证码超时';
var msg_authenticCodeError = '验证码错误';
var msg_passwordCanntEqualName = '您的密码与账户信息太重合，有被盗风险，请换一个密码';
var msg_verifyCodeFocus = "请输入短信验证码";
var msg_verifyCodeEmailFocus = "请输入邮箱验证码";
var msg_verifyCodeNotEmpty = "请输入短信验证码";
var msg_verifyEmailNotEmpty = "请输入邮箱验证码";
var msg_verifyCodeNotError = "短信验证码错误";
var msg_verifyEmailCodeNotError = "邮箱验证码错误";
var msg_verifyCodeError = "验证码错误";
var msg_verifyCodeTimeOut = "验证码超时";
var msg_verifyCodeSend = "验证码已发送，请查收短信";
var msg_emailError = "邮箱地址不正确，请重新输入";
var msg_emailLength4To50 = "邮箱地址长度应在4-50个字符之间";
var ele_name = 'name';
var ele_password = 'password';
var ele_confirmPassword = 'confirmPassword';
var ele_authenticCode = 'authenticCode';
var ele_verifyCode = 'verifyCode';
var ele_verifyCodeEmail = 'verifyCodeEmail';
var ele_name_text = '用户名';
var ele_password_text = '登录密码';
var ele_confirmPassword_text = '确认密码';
var ele_authenticCode_text = '验证码';
var ele_verifyCode_text = '短信验证码';
var ele_verifyCodeEmail_text = "邮箱验证码";
var emailSurfixArray = ['@163.com', '@126.com', '@qq.com', '@sina.com', '@gmail.com', '@sohu.com', '@yahoo.cn', '@vip.163.com', '@vip.126.com', '@188.com', '@139.com', '@yeah.net'];
function changeImageAuthenticCode(captchaId) {
    $("#authenticCode").val("");
    $("#" + captchaId).attr("src", captchaSrc + "&timestamp=" + Math.random());
//		var $clone=$("#normal-register-captcha").find("img").clone();
//		$("#normal-register-captcha").find("img").remove().end().prepend($clone);//深拷贝
//		var $clone=$("#"+captchaId).parent().find("img").clone();
    var $clone = $("#" + captchaId).clone();
    $("#" + captchaId).parent().find("img").replaceWith($clone);
//		var $normal=$("#normal-register-captcha");
//		$normal.prepend($normal.find("img").detach());//浅拷贝
}
$(function() {
    /* 连锁分部*/
    lhh.clickshow(".select-segments", "hover", ".segmentslist");
    $("#registerNow").click(function() {
        handleCreate()//alert()
    });
    $("#name").blur(nameBlur);
//      $("#email").blur(emailsBlur);
    /*手机blur判断条件*/
    $("#mobile").focus(function() {
        $(this).addClass("focus").removeClass("err");
    })
    $("#email").focus(function() {
        $(this).addClass("focus").removeClass("err");
    })
    $("#mobile").blur(function() {
        $(this).removeClass("focus");
        if ($("#mobile").attr("isClick") == "true") {
            checkTelphone();
        }
    });
    /*邮箱blur判断条件*/
    $("#email").blur(function() {
        $(this).removeClass("focus");
        if ($("#email").attr("isClick") == "true") {
            emailsBlur();
        }
    })
    $("#email").unbind('keyup').bind('keyup', moreName);
    $("#email").bind('focus', moreName);
//      $("#name").unbind('keyup').bind('keyup', moreName);
//      $("#name").unbind('focus').bind('focus', moreName);
    $("#password").unbind('keyup').bind('keyup', changePasswordGrade);
    $("#password").blur(passwordBlur);
    $("#password").focus(function() {
        if (this.value)
            $("#pwd-safe").show();
        if ($("#tj_name").css("display") == "block") {
            $("#password").blur();
        }
        $("#passwordSuc").hide();
    });
    $("#confirmPassword").blur(confirmPasswordBlur);
    $("#authenticCode").blur(authenticCodeBlur);
    $("#authenticCode").unbind('keyup').bind('keyup', validateAuthenticCode);
    $("#authenticCode").unbind('keyup').bind('keyup', function() {
        var authenticCode = $.trim($("#authenticCode").val());
        var verify = authenticCode.length >= 4 ? 'yes' : 'false';
        $("#" + ele_authenticCode).attr('verify', verify);
    });
    $("#verifyCode").blur(verifyCodeBlur);
    $("#verifyCodeEmail").blur(verifyEmailCodeBlur);
    enableConfirmPassword();
    clearRegInfo();
    /*获取短信验证码*/
    $("#getVerifyCode").click(function() {
        var mobile = $("#mobile").val();
        if ($("#mobile").attr("verify") == "yes") {
            sendMobileActiveCode(mobile, "send");
        }
    })
    $("#resendSpan").click(function() {
        var mobile = $("#mobile").val();
        if ($("#mobile").attr("verify") == "yes") {
            sendMobileActiveCode(mobile, "send");
        }
    });
    var emailSurfix = ['@189.cn', '@163.com', '@126.com', '@qq.com', '@sina.com', '@gmail.com', '@sohu.com', '@yahoo.cn', '@vip.163.com', '@vip.126.com', '@188.com', '@139.com', '@yeah.net'];
    emailSurfixArray = emailSurfix ? emailSurfix : emailSurfixArray;
    $("#name_list li").live({
        mouseover: function() {
            $(this).addClass("hover");
        },
        mouseout: function() {
            $(this).removeClass("hover");
        }
    });

    $("#getVerifyCodeEmail").click(function() {
        var email = $("#email").val();
        if ($("#email").attr("verify") == "yes") {
            sendEmailActiveCode(email, 'send');
        }
    });
    $("#resendSpanEmail").click(function() {
        var email = $("#email").val();
        if ($("#email").attr("verify") == "yes") {
            sendEmailActiveCode(email, 'send');
        }
    });
    $("#goTo").click(function() {
        window.location.href = contextPath + '/register/index/company';
    });
    //国美协议
    $(".agreement-link").click(function() {
        $(".agreement-cont").toggle();
        omnitureForLink('国美在线服务协议');
    });
    //失去焦点改变颜色
    $("input.i-text").blur(function() {
        if ($(this).val() != '用户名') {
            $(this).attr("style", "color:#5e5e5e;");
        }
    });
});
//页面名+表单名+文本框名
function omnitureForForm(value) {
    var s = s_gi(s_account);
    s.linkTrackVars = 'prop51';
    s.prop51 = '注册页面+注册信息输入表单+' + value; //记录所使用的文本框名 
    s.tl(this, 'o', 'form_track');
}
//当前页面名称:+关键按钮所处位置:+关键按钮名称
function omnitureForLink(value) {
    var s = s_gi(s_account);
    s.linkTrackVars = 'prop20';
    s.prop20 = '注册页面:个人用户注册:' + value; //记录关键按钮名称 当前页面名称:+关键按钮所处位置:+关键按钮名称
    s.tl(this, 'o', 'register_key_position');
}
/*    $(function(){
 showCouponText();
 });
 function showCouponText(){
 var sendtimestamp=new Date().getTime();
 var url = contextPath + "/myaccount/includes/registerPageCouponText.jsp?sendtimestamp="+sendtimestamp;
 $.ajax({
 type: "post",
 url: url,
 data:{},		  
 success: function(data) {
 var datas = data.split("|");
 var linkText = $.trim(datas[0]);
 var linkHref =  $.trim(datas[1]);
 if(linkText!='' && linkHref!=''){
 $("#couponAd").html("<a href=\""+linkHref+"\" target=\"_blank\" class=\"red\">"+linkText+"</a>");
 }
 }
 });
 }*/

